package com.youtellv1.service.Impl;

import com.youtellv1.dto.YSalDTO;
import com.youtellv1.entity.YSal;
import com.youtellv1.mapper.YSalMapper;
import com.youtellv1.service.YSalService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class YSalServiceImpl implements YSalService {
    @Resource
    private YSalMapper ySalMapper;

    @Override
    public int countById(Integer tid) {
        return ySalMapper.countById(tid);
    }

    @Override
    public YSal findById(Integer sid) {
        return ySalMapper.findById(sid);
    }

    @Override
    public List<YSalDTO> findByTidWithPage(Integer tid, int page, int size) {
        int offset = (page - 1) * size;
        return ySalMapper.findByTidWithPage(tid, offset, size);
    }

    @Override
    public void insert(YSalDTO ysaldto) {
        ySalMapper.insert(ysaldto);
    }

    @Override
    public void update(YSalDTO ysaldto) {
        ySalMapper.update(ysaldto);
    }

    @Override
    public void delete(Integer sid) {
        ySalMapper.delete(sid);
    }
}
